<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul class="ul">
      <li class="li">1</li>
      <li class="li">2</li>
      <li class="li">3</li>
      <li class="li">4</li>
    </ul>
    <script>
      window.onload = function (e) {
        document
          .getElementsByClassName("ul")[0]
          .addEventListener("click", function (e) {
            if(e.target&&e.target.nodeName == 'LI'){
                e.target.innerText = '我被改变了'
            }
              
          });
      };
    </script>
  </body>
</html>
